No, you were not at risk for HIV transmission from mutual masturbation and wearing your underwear without cleaning up after. HIV is only spread through unprotected vaginal or anal sex or sharing of IV drug needles. It has to take place inside the body. So, this was not a risk in any way for HIV. NGU or NON gonococcal urethritis means it was NOT caused by gonorrhea. You can get NGU from touching but you can NOT get hiv that way.
When engaging on a mutual masturbation is normal to get body fluids in our hands and body, but this situation has never resulted in a single case of infection along the 40 years of history of HIV. The only ways this virus is spread are:
-Unprotected anal/vaginal penetrations.
-Sharing needles to inject drugs.
-Mother to child.
All the best.