None of the above is quite accurate.
In modern military rifle parlance, the term "lock" means to apply the safety. In the days of the Model 1903 Springfield, shooters preparing to fire timed and rapid fired were ordered to "load and lock". With the bolt open, they inserted a clip, stripped the rounds into the magazine, closed the bolt and set the safety to ON to make the rifle safe. There was a possibility of accidental discharge while closing the bolt, but the bolt could not be operated with the safety on.
When the M1 rifle was introduced, it became apparent that it could be loaded with the safety on, and that that procedure was safer, so the command was changed to "lock and load". The shooter, with the rifle bolt to the rear, set the safety to ON, then loaded an "en bloc" clip and closed the bolt in complete safety.
The term "lock, stock, and barrel" really does refer to a firearm of the percussion or flintlock type. Since the lock, the stock, and the barrel were the main parts of that type of firearm, the phrase meant "the whole thing."
Jim