According to Sherif Hashim (@sherif_hashim), the famous iPhone baseband hacker, iOS 4.0.2 do not upgrade your iPhone's baseband and hence you can unlock your iPhone on iOS 4.0.2 with the latest version of Ultrasn0w. So far Redsn0w(v0.9.5b5-5) can jailbreak iOS 4.0.2 on iPhone 3G and iPod Touch 2G(non-MC models), so you can only unlock iPhone 3G with Ultrasn0w 1.1-1.
iPhone Dev Team official announcement (via iphwn.org):
Install ultrasn0w if you need a carrier unlock (and in the USA, remember to turn off 3G mode in Settings?General?Network).
Sherif Hashim's tweet:
To jailbreak iPhone 3G running iOS 4.0.2 with Redsn0w, you can follow our step-by-step guide here. Once jailbreaked, install Ultrasn0w 1.1-1 through Cydia to unlock your iPhone so that you can use it with an unofficial carrier. The guide to install Ultrasn0w 1.1-1 is exactly similar to the guide to install Ultrasn0w 1.0-1 which you can find here.Contact Us for News Tips, Corrections and Feedback