UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6gqU7r4jFsxfnYgCX/QCrq817LtTn8sXs2qh0Fqp0Pw=' 
WHERE 
  key_id = '8b43b1ba1db35d4a7e43fcd30e65400d740df95b6ea9d41e43e517873155e02f' 
  AND (
    token = '6gqU7r4jFsxfnYgCX/QCrq817LtTn8sXs2qh0Fqp0Pw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025