Can’t be done with a ST Routine using Phil’s driver. He didn’t create a custom capability to provide the codeName for locking events as a trigger in Routines. It can be done with this driver, however, his driver is not free.
You can do this with the 3rd party rules engine sharptools.io, but it requires their paid tier at $30/yr. Below is an example of checking who locked the door and taking actions based on that.
In this example, it checks for a specific person’s code as well as checking if the Schlage logo was pressed which is reported as codeSlot 0 or codeName Master. Other thing to note is that sharptools rules run on their cloud, not locally on your hub.