UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0IBrcaDj9VdBwLD40/rEPWX/D/DZOyEE374TzeSjxc0=' 
WHERE 
  key_id = '3bc9bbaf762c173017c370a9841ca095e38df29a8608ccd008ed6dc232d8483f' 
  AND (
    token = '0IBrcaDj9VdBwLD40/rEPWX/D/DZOyEE374TzeSjxc0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038