UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3egrsBbhZx/nUGo7hI4ZCt3uGQywETrJJVajVB69v/Q=' 
WHERE 
  key_id = '27e770673d2b0f77ec4a432069a688216a511a67d8c350a2a10840a78ff5c072' 
  AND (
    token = '3egrsBbhZx/nUGo7hI4ZCt3uGQywETrJJVajVB69v/Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00079