This sounds very similar to my som who's more or less the same age. No advice as such but hopefully it's just a phase as it seem quite common at this age from what I've seen and read. It's so hard, but hoping for a shift x
I would say in general is very normal. Lasting 30-40 mins is a bit much I think but maybe take a step back and see how you are approaching him and based on what need. My son has realized he can put on a cry and get a reaction so I assess what hes whining about before I react. Sometimes hes just frustrated his cars wont line up. I wont look at him, ill just let him sort it and he normally does. I find if you micromanage the emotions constantly they wont figure it out. My son knows when hes having a hard time he comes up to me and says hug lol its quite cute and we have a good hug and kiss and usually hes off again. If we was carrying on for 15+ minutes about every little inconvenience it usually is hes tired and or sick so we go to bed early. Last night he was just cry at absolutely everything and nothing would really make it better so we just kept everything calm and positive. I got him to “help me” put our baby doll to bed (currently pregnant) he was very proud and went to bed early.
My daughter is the same so I’d say it’s normal for this age x