I created a macro to lock the computer and assigned it the same hotkey ^⌘Q
This macro would log me out of Lastpass, but the main thing was to set the variable, enable the "App Activation on Screen Unlock" macro, and then put the system to sleep. The "App Activation on Screen Unlock" macro would use the Disable Macro step to disable itself.
I mainly did this for the Lastpass Mac application, but then Lastpass dropped support for the Safari version and that does not work as well for regular applications. So I have had this disabled and am not sure if it behaves the same with Catalina.
I ended up using another tool: EventScripts by Mousedown. It's a small MenuBar app which can trigger scripts on Screen unlock and many other events.
I have setup some Applescripts which are triggered by Eventscripts' Screen unlock and Screen wake events. The Applescripts in turn call KM macros which do the actual work I need to be done (toggling a Target Mode on another iMac).