UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '//k9xsrwF3/y38nqKJWx79wimgnacrbbWz1BTC65k00=' 
WHERE 
  key_id = '5d5909f48f0537774d883c8b75f10e5377b1b480891823e9608551b504c0f232' 
  AND (
    token = '//k9xsrwF3/y38nqKJWx79wimgnacrbbWz1BTC65k00=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042