Was in exact same position few years back , got to 40 and suddenly realised life is marching on and have i really got the life I wanted, stuck in a rut, and a bit lost, its called a mid life re-evaluation, most people will experience this at some point, it can either give you the impetus to change direction or buckle down and carry on as you were. For me I was stressed with work, suffering depression, due to travelling all other the world with work ( which was very well paid) but little in the way of relaxation or social time with friends, and relationships and mental health suffered as a result.
Had a few years of ups and downs but took up Yoga, travel less with work and not chasing promotions anymore ( earn less but no issue there as I only ended up buying useless expensive stuff anyway) stopped comparing myself to others and where I should be in life rather than enjoying where I was and what I had, and now seem to be in a slightly better place, making new friends and trying new things ( ie join a band/drumming circle, took up road riding, photography, etc.. where you’ll meet people with similar interests) Earning more money does not bring happiness. I thought it would. It didn’t. Still get a bit of depression from time to time but I now know the signs and can make small life adjustments accordingly.