If you are on the AUP, and sell your iPhone privately, you must pay off the loan before you can get an upgrade. Alternatively, if you have made at least 12 loan payments and trade in your phone to Apple, you will be elgable for an upgrade. You would get a new phone and have a new cycle of loan payments.
Jay