UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3n39V4UzxkxjZZ6Vaepggj/U8N22MxYtngxxAMNqVW0=' 
WHERE 
  key_id = '42754be780d89fa137fb38b2c6051c6ea5e94724ea64cc38e76dc2b5ca177432' 
  AND (
    token = '3n39V4UzxkxjZZ6Vaepggj/U8N22MxYtngxxAMNqVW0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034