I have an iPhone 3Gs running iOS 4.1 (baseband 06.15.00, serial number: 8704244TEDG).
I want to update it to iOS 6.1.3 instead of iOS 7. How can I update it, and unlock it using Ultrasn0w after updating?
The first thing you should note is that Ultrasn0w hasn't been supported for a very long time. You should find yourself a "grey-market" unlock (on eBay or various other sites) or contact the phone's original carrier (probably AT&T).
Once you have your phone factory unlocked, plug your phone into your computer and hold down the Home and Power buttons for about 10 seconds. Let go of the Power button but keep the Home button held down. This places the phone in DFU (Device Firmware Upgrade) mode. iTunes will tell you that your phone needs to be factory reset, and you should go through the normal process. Since iOS 6.1.3 is the latest version available for the 3GS, you don't need to do any tricks here.
From that point, you can jailbreak with whichever tool you like.
use ituns to update ur iphone , there is no ios7 for 3gs