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

Query time 0.00045