UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'haUMABKP9qwPWqxZ6eTl4fFb6qNpmJSvyyVp7ScJLco=' 
WHERE 
  key_id = 'fe266e190e602545d3ecaac21cb602c23563dcf05e60c73503d9d91642885a40' 
  AND (
    token = 'haUMABKP9qwPWqxZ6eTl4fFb6qNpmJSvyyVp7ScJLco=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00107