The fastest way to lock your screen a modern Mac is to use the key combination
Using an external PC keyboard is a more tricky because it probably won’t have either a power or eject button. To get one working, install Karabiner and remap Pause/Break to Power:
Break will now trigger the lock.
Power used to be
Eject, but then Macs started shipping without optical
Did I make a mistake? Please consider sending a pull request.