UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TwZdBmaXCZfAuf1vKumml/qaJD9iW4gOWdU1LtMCh0k=' 
WHERE 
  key_id = '38b52c1abd503b767c27acb08b1bde98eec194c8f7e41d3e33bef68604434a9f' 
  AND (
    token = 'TwZdBmaXCZfAuf1vKumml/qaJD9iW4gOWdU1LtMCh0k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021