UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BOyt8ur9RyhtvB+EshdLDLn1jkM1vAScI2bIJlxH9pU=' 
WHERE 
  key_id = '982079a43e6509486bcfd9ee25e28440ca1da1be75709c54c5b1a88cc6562cff' 
  AND (
    token = 'BOyt8ur9RyhtvB+EshdLDLn1jkM1vAScI2bIJlxH9pU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023