Ransomware protection

I’m hoping that, if I password-protect my external drive (a Passport Essential USB 3.0), that ransomeware can’t lock me out of it, but I fear I may be wrong.

Can this malicious software just lock my locked drive anyway?

Ransom-ware usually works by locking access to files, not physically locking the drive.

So imagine this… You get the virus, it locks access to all the files on your computer- if the drive is connected and unlocked at the time it could lock those files as well.

HOWEVER

If the drive is locked at the time, the virus most likely will not be able to access any files on the drive unless you unlock it on the infected machine. More sophisticated malware may be able to get around it, but it should help (with some basic opsec) against the garden variety stuff.