The default keyboard shortcut for locking the screen on macOS Mojave is Command + Control + Q. You can use these keystrokes at any time. Once you hit the command sequence on the keyboard, the current macOS user session screen will instantly lock, requiring a login to regain access to the session.
This is equivalent in functionality to the Command + L key combination in Microsoft Windows. You can also select this key combination from the Apple menu.