I should’ve added “given enough time” to that statement.
My take is that if you accept that there’s nothing you can do, then that’s it. If you don’t accept that, you have a chance of improving the outcome, even if it’s small. Giving up never improves your outcomes, there’s always something you can try that both won’t make things worse and might make things better.
In your scenario, you have two options: accept death or try something. Since you aren’t going to make it worse, you might as well try something. Some options:
pick the lock
break the lock
squeeze through the bars
try to use magic to grow gills or something
Literally any of those has a higher chance of success than doing nothing, and if you had more time, one of the first three might even work. If by some miracle you get out, the next step is to look for a pocket oh air. And so on. Take it one step at a time.