UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd9MH/BvsoK9jjtOjKYA3zPClkusC1XrFIDCHkMGOzM8=' 
WHERE 
  key_id = '0171dd919d5c9ba652ed09fc9b226081a199323be27be02059f767b70f55d638' 
  AND (
    token = 'd9MH/BvsoK9jjtOjKYA3zPClkusC1XrFIDCHkMGOzM8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041