It depends whether you have a refresh contract or not.
If you have a refresh contract you will need to pay off your device plan and then you can upgrade
If its already paid off, or your over the 24 months of your contract you can upgrade now
If you're with a 3rd party vendor such as Carphone Warehouse then you will need to pay off the remainder of your contract before you can upgrade.
If you sign in to MyO2 it will tell you when you can upgrade