UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D6aqI7vM80OBuH9APRTWOsWdMWmJALp8qqev/5rSFW8=' 
WHERE 
  key_id = 'ae1e99eb86d385eb1a564689e39fd03b26c50c49bce5fb22a65e18fb9e7399bd' 
  AND (
    token = 'D6aqI7vM80OBuH9APRTWOsWdMWmJALp8qqev/5rSFW8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016