AMENDED AND RESTATED TERM LOAN SECURITY AGREEMENT