UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3Bw9Au9yoBCvAJzyMhhuSvPzMFNlonU+JDIigyoCBeI=' 
WHERE 
  key_id = '29ba5d37e77c5565d70e4b7066239adbf9176191ec850ff65cca7235d6d0c234' 
  AND (
    token = '3Bw9Au9yoBCvAJzyMhhuSvPzMFNlonU+JDIigyoCBeI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036