This is a great question, and it comes up a lot. The honest answer is that neither of the two options you described is really the right move when you're training. Both are test-taking behaviors, and training is a different thing from testing.
When you're still learning a topic, the goal isn't to simulate test conditions. It's to understand how the questions work. So you don't want to put yourself on a clock and bail to a guess after a few minutes. Constraining your time during the learning phase just cheats you out of the learning. If a hard question is killing you, that's not something to route around with a guess. It's a signal pointing you straight at a gap.
That said, you also shouldn't grind on one question for twenty minutes, staring at it and getting nowhere. So here's what actually works. Give the question a full, genuine attempt, taking whatever time you need. If you get it, great. If you hit a real wall and you're truly stuck, that's your cue to go to the solution, study the approach, and figure out exactly what stopped you. Was it a concept you hadn't learned yet? A step you didn't know to take? A misread? Then come back a day or two later and redo the question from scratch to make sure it stuck. That's the loop that turns a hard question into progress. A guess just skips the whole thing.
The logic is simple. A question you can't solve in two minutes means you don't yet have the skill to solve it in two minutes, and rushing to a guess won't build that skill. Speed comes from mastery, not from forcing the clock before the content is solid.
Now, the "test attitude" you're describing, best guess, mark it, move on, is a real and important skill. It just belongs to a later phase: timed sets and practice tests, once your untimed accuracy on a topic is already high. On the actual exam, you should never sink four-plus minutes into one stubborn question. There you guess and move on to protect your time. But that's something you layer on later, not a shortcut you use while you're still learning.
So while you're training a topic, work the tough questions all the way through and study the solution when you're stuck. Save the guess-and-move-on discipline for timed practice, after your accuracy is where it needs to be. This article gets into the same idea in more detail:
The Best GMAT Practice Methods.
ChristosXiro
When I am training and I see a very difficult question that is killing me should I approach it with test attitude and after some minutes make an educated guess, or try to solve it even if it takes much more than it should?