You can usually lock the screen by hitting ctrl-shift-power, but that will power down external monitors, which might take several boring seconds to start up again. Also, a MacBook with a TouchBar doesn't have the power button anymore. With the following guide you can lock the screen by starting the screensaver, keeping the monitors running.
Set System Preferences » Security & Privacy » General »
immediately after sleep...
The simple way
Download enable-screensaver.zip and unzip it to
(If you use OSX Sierra or older, use enable-screensaver-10.12.zip instead)
Go to System Preferences » Keyboard » Shortcuts » Services » General » enable-screensaver.
Choose a hotkey for it (I use ctrl-alt-cmd-k). You're good to go!
The difficult way
Start Automator, choose File » New and Service
Select that the Service receives
Double click Library » Utilities » Run Shell Script
In the shell text field, add
/System/Library/CoreServices/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine > /dev/null 2>&1 &
(If you use OSX Sierra or older, use
Save the Service as
Perform steps 2. and 3. above