AMENDMENT NO. 2 TO AMENDED AND RESTATED NOTE PURCHASE AGREEMENT AND CONVERTIBLE NOTE