$query = 'UPDATE #__jcp_polls SET published='.$this->_db->getEscaped($state).' WHERE id='.$this->_db->getEscaped($cid);
This line was the problem with SQL query error. So I changed it to this one:
$query = "UPDATE #__jcp_polls SET published = '".$state."' WHERE id = '".$cid."'";
And now everything works good. Please, check this.

