UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZlyWpB7vVhvfGxKX+hbnLhoaukrUkq3bVvC0n+O++m0=' 
WHERE 
  key_id = 'b438296d5c04a54e3ea6c91b70f84a824007c0a388bce84c66882fa13c8f50cc' 
  AND (
    token = 'ZlyWpB7vVhvfGxKX+hbnLhoaukrUkq3bVvC0n+O++m0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042