It may be done at anytime, but no later than 72 hours before you are due to travel. You are not required to have any firm travel plans before registering and we recommend that you register as soon as you have made reservations or have purchased tickets.
What should I do if I have obtained a new passport or have changed my name, date of birth, citizenship or gender, or my eligibility to travel visa free has changed
If you have obtained a new passport, changed your name, date of birth, citizenship, or gender you are required to apply for new travel authorization. You cannot amend your existing registration. If you are no longer eligible to travel visa free under the Visa Waiver Program, you will be required to apply for a visa.