Apple script to lock computer using knock
I sent a question to the support personel at knock, and they informed me that a script has already been written. The creator blogged about this just hours before this question was opened. 

http://blog.ambroselittle.com/lock-mac-with-keyboard-shortcut-and-knock/

There is both an alfred workflow and an apple script to do this.