UHC code is immediately available to you after you fill the online form. However, your airline in your departing city will probably ask for the UHC code so you might have to fill it before your layover.
When I was filling the form, given the answer choices, I got the impression that I can fill and receive the UHC code 36 hours before my flight (though they say fill it 24 hours before). If you want, you can try that.
Cheers from Dar es Salaam, the city where you do not need masks
Well, I have my two doses