The locked status of a UTXO (unspent transaction output) is not a blockchain-level event but rather just a status which is managed within the node's wallet. Any locked output will not be used when automatically selecting outputs to create a new transaction. So there's nothing to prevent you unlocking an output which belongs to an external private key.