AMENDED AND RESTATED CONVERTIBLE PROMISSORY NOTE AND WARRANT PURCHASE AGREEMENT