The transaction is
valid if it's complied with the
protocol. Once it's been included into a block we call it
confirmed.
Now, in a situation where I want to buy a grocery from the local shop for 0.0001 Bitcoin, should I wait 10 minutes (maybe 5) so that the seller makes sure that the transaction is valid?
If your transaction has
replace-by-fee disabled, then it's safe enough from the merchant's side to consider the transaction settled, even if it isn't confirmed yet. It's still possible to have it reversed, say if you paid a miner to include a different transaction that spends the same output(s).
If the merchant disagrees with the unconfirmed settlement and you don't want to wait, then you can't use Bitcoin on-chain. Introducing... The
Lightning Network!
As far as I know, this can only happen in the case of a 51% attack
Not only. With 51%, it's highly likely that you can reverse anything; it's just a matter of time. With less than 50%, your chances drop exponentially, but for one who wants to reverse a transaction that was just confirmed, much less percentage of the hash rate is sufficient. For example, with 24% you have a 50.1% chance of overwriting the previous block.
For anyone who owns less than 50%, say 10%, it's improbable to succeed, even for a block; it's 20.4%. Check
this. It'll return you the probability of any combination you submit.