Open System Preferences using Spotlight by hitting
cmd + space bar and typing System Preferences. Then click Keyboard.
Near the bottom, click on either Customize Touch Bar..., which will open the touch bar settings.
Click on the Screen Lock icon and drag it off the bottom of your screen and you'll see it appear on the touch bar. You can drag it side by side to place it where you'd like.