UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9imZBvbpF8+wwzTFbmTXAFaCo4ETsadGy6Z2zSgpBww=' 
WHERE 
  key_id = 'b73372e9f6722671f9d543726b08d41e748a3c4ce926b8c7955f6937942d9003' 
  AND (
    token = '9imZBvbpF8+wwzTFbmTXAFaCo4ETsadGy6Z2zSgpBww=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028