UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IKaBFkAgU1Ok5N28UyFX9zRveq7gNEbOozVlxTMpR+8=' 
WHERE 
  key_id = '50583fb6d2223477a798eaa41882d7a09dc813edf21bc12cf4f9898eddd2f34b' 
  AND (
    token = 'IKaBFkAgU1Ok5N28UyFX9zRveq7gNEbOozVlxTMpR+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030