It is possible to breach a door using bullets, but a normal handgun is normally underpowered.
Shotguns are suited for this task. The door isn't unlocked but partly broken so that it opens.
Ballistic breaching uses a projectile weapon to breach an opening. Weapons used can range from small arms to the 120mm cannon of a main battle tank with a HEAT round, which will breach most obstacles easily, though the force involved may violate the rules of engagement. A less damaging ballistic breach needs to destroy either the latch and lock, or the hinges of the door, and the ideal choice for this is the shotgun. While in theory other firearms can be used, handguns are usually underpowered and rifles are less effective than the shotgun and pose a far higher risk of ricochet and collateral injury. Most shotgun ammunition can be used for breaching, though the risk of injury varies with type.
 FM 3-06-11. US Army. http://www.globalsecurity.org/military/library/policy/army/fm/3-06-11/ch3.htm. Section 3-20, Breaching
 Don Munson. "Action Target’s Tactical Breach Door". Tactical Response Magazine. http://www.hendonpub.com/publications/tacticalresponse/forcedentry.aspx.
 US Army. FM 7-8 INFANTRY RIFLE PLATOON AND SQUAD. http://www.globalsecurity.org/military/library/policy/army/fm/7-8/ch6.htm. Chapter 6, Urban Operations
 See Mythbusters Special 9