Tasker has NFC reading capabilities and is programmable to do stuff when it detects an NFC ID, I don't know if it can lock the phone though (there's an app called Lock My Phone, and Tasker has the ability to cause apps to take some actions, but I don't know if both can be combined).
E.g. I have 2 NFC tags on my desk, when Tasker detects one of them, it calls a HTTP URL of a PHP script on my NAS, the script tells my Hue Bridge to switch on a Hue-enabled power socket (into which my monitor and speakers are plugged), and then the script sends a Wake-On-LAN packet to my desktop PC. The other one turns off that Hue-enabled power socket (I put my computer into sleep separately).