Temporarily disable Windows Defender or your 3rd party antivirus (McAfee, Avast, etc.).

Windows often locks drives because it recognizes a corrupted partition. Clearing the partition table usually kills the lock. Press Win + R , type , and hit Enter. Type diskpart and hit Enter.

If you have the USB folder open, Windows "locks" it to display files. Close all Explorer windows.

TransMac has a built-in formatting tool that sometimes works better than the restoration tool when a lock is present. In TransMac, right-click your USB drive. Select . Give it a generic name and let it finish.