second AMENDED AND RESTATED SECURITY AGREEMENT