Any time you want.
When you renew a domain, the renewal period begins at the end of the current registration period. In other words, renewing for one year adds one year to the current expiration date, even if the current expiration date is months (or years) away.
Exception: Your domain can never be registered for more than ten years. So if a domain's current expiration date is 9.5 years away, our system will return the error "this domain is already registered for the maximum duration" and not allow a renewal attempt. You'd need to wait until a full additional year could be added before you'd be able to renew it.
Please don't wait until the last possible minute to renew (or transfer) your domain.