You'll need to accomplish this using a MDM solution like MSP, you create a condition on which you want to execute the Lock and Wipe, provision the job. Once the condition is meet you have the ability to lock and wipe the device.
MSP How to attached
Usefull document, have been looking & asking for this kind of How-To documents for a while!
Do you have more like this one..?