UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0cAH3QL6RiP9UnQej+mobXfJskOJOeI7y8YxdoZBuDQ=' 
WHERE 
  key_id = '1c7a80b7c782f0d3da74694df65169254d358178a2a4540762d8933ec3eea2b6' 
  AND (
    token = '0cAH3QL6RiP9UnQej+mobXfJskOJOeI7y8YxdoZBuDQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017