UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jMg5IjPYcm8idzaLDSSPvl36rtRDsyigIkp0OmJM4lc=' 
WHERE 
  key_id = 'da513f13866397d7512739de46189fbfab09a347373f191cfbf6a602719835d3' 
  AND (
    token = 'jMg5IjPYcm8idzaLDSSPvl36rtRDsyigIkp0OmJM4lc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022