I don't know of an app that directly does this, but I believe you could use the app
Control Plane to accomplish this. Have the app watch for a specific USB drive to disconnect, then have that launch a script to lock the machine?
Here is the Applescript you would need.