I wrote nearly all of https://apps.apple.com/us/app/two-birds-one-stone/id15396463... on a train without internet. It was about a half hour journey, and I found that in such a short amount of time, I would set a small goal and work in a very distraction free way to achieve it. It was very good for doing small things, but sometimes doing larger things (like big refactors) is a bit more difficult. On occasion, I would also dedicate a train ride to just writing up a todo list.
I gave myself the rule of no internet while on the train, so sometimes I would just accumulate a list of questions I wanted to answer later.
There is definitely something to it, and you can get heaps done, but it needs to be supported with some non-train time (e.g. for me, it was all the app store stuff, debugging with real hardware, etc)
30 minutes can be plenty of time for implementing a feature. If you got your priorities straight.