What is wrong with this wpdb update?

you’re creating the $data and $where values as strings, not arrays.

this:

$data = "array( 'somecol' => '".$newstr."' )";
$where = "array( 'id' => ".$defid." )";

should be:

$data = array( 'somecol' => $newstr );
$where = array( 'id' => $defid );

error code: 523