There will usually be more than one prisoner to free, making killing a Goon to get a single key usually isn't enough. Destroying or using the near by computer is the best way to free everyone quickly.
You can also use a Hacking Tool or if you're playing as a Hacker use the Laptopspecial ability to hack the computer and pick "Open Locked Doors" option to free the prisoners from a safe distance.