UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mwFAs2qylCS3acTtIccnzcCSSK1jPGQj9tmWCG3is/o=' 
WHERE 
  key_id = '40e03c72bde742e30747ce03fda48cffa04d5dc1262db5a6789e3fea15fa65ac' 
  AND (
    token = 'mwFAs2qylCS3acTtIccnzcCSSK1jPGQj9tmWCG3is/o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065