UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NZqvX0/wT9u3rHwOVyawcz32YLxghKz8LQ60Oilhkfg=' 
WHERE 
  key_id = '67c4a821993afeee70d4996e24db7b1a52e44e3024377d3e47a4e9bd8497b4ba' 
  AND (
    token = 'NZqvX0/wT9u3rHwOVyawcz32YLxghKz8LQ60Oilhkfg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029