Open System Preferences using Spotlight by hitting
cmd + space bar and typing System Preferences. Then click Keyboard.
Near the bottom, click on Customize Control Strip... 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.
Now whenever you need to step away from your computer, you can quickly lock the screen by clicking on the Screen Lock icon on your touch bar!