add is null condtion in db_update
As per documentation, there is a method just for that: -&gt;isNull()

$query-&gt;isNull('myfield');
// Results in (myfield IS NULL)
$query-&gt;isNotNull('myfield');
// Results in (myfield IS NOT NULL)