UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ccoycK8sTFga8PdIkA2YzvWDjeeFVFjMQfPLzNkmPwc=' 
WHERE 
  key_id = '021781accc3c8a65854ff0608db155f1fd935db8811a0e4c52fca462c32aaa77' 
  AND (
    token = 'ccoycK8sTFga8PdIkA2YzvWDjeeFVFjMQfPLzNkmPwc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021