I have my mac in a dock and the power key is not accessible to me so the standard hotkey to lock my mac is unavailable. So I created a very simple workflow to lock my mac for when I walk away. I also added a bash script to press enter for you so you don't need to press enter before you walk away.
You can change the hotkey to whatever you would like but pressing Command+End will lock your mac.