UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ScmQZcxuOijyKmSucrVrasm/5OtCqCefVY8fSobrHWc=' 
WHERE 
  key_id = '9404fb3c0e4717baa68f1e5552b0e67c93d08b9f27771857ca35558436eedaea' 
  AND (
    token = 'ScmQZcxuOijyKmSucrVrasm/5OtCqCefVY8fSobrHWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016