The preparelockunspentfrom command cannot be used with an external private key, since it's one of the high level APIs. However you can perform the equivalent action as follows:
- Use createrawsendfrom to prepare a transaction sending the appropriate amount back to the same address.
- Use signrawtransaction and sendrawtransaction in the usual way to get this transaction signed using the external private key, and then sent.
- The amount you want (equivalent to preparelockunspent output) will be in the transaction output with the txid given by the output from the previous step, and with vout 0 (zero).
- Use the lockunspent API to lock this transaction output.
That's it. You'll now be in the exact same situation as if you'd used preparelockunspentfrom.