How likely is it for coastal cities to survive next 40 years?
I also live on the coast and have been concerned about what to expect with regard to sea level rise in the near future. The following graph illustrates the observed rise in sea level over the last 30 years:

As you can see from the image, satellite data indicates a linear increase in sea level rise of 3.3 mm per year for the last 30 years. If this trend continues for the next 40 years, we will see an increase in sea level of 133 mm. The real question is whether or not the linear trend will continue or will it accelerate as a result of climate change?
One possible way to look at this is to compare what temperature has done over roughly the same time period to see if there is any indication that temperature change is accelerating. The following image shows three sets of data with regard to temperature:

The data in this image represents observed temperature changes from balloons and satellites and temperature predictions from computer models. The interesting aspect of this image is the balloon and satellite observations track very close to each other while the model predictions of temperature change are roughly 3 times greater than the observations. Another interesting point is that while the temperature is trending upward for the overall duration, there are multiple periods where the temperature is getting cooler.
There is no obvious sign of acceleration in the observed data, but the current climate orthodoxy would indicate otherwise as indicated by the climate models and as a result of increased CO2 in the atmosphere. So the next logical step is to see what the CO2 levels have done over roughly the same period of time.

For the last 30 years the CO2 has increased linearly at about 2 parts per million (PPM) per year.
Just looking at the data, it would appear the 133 mm increase in the next 40 years would be a good conclusion, but again the current climate orthodoxy disagrees because it is believed small temperature increases resulting from increased CO2 is amplified by the positive feedback caused by the additional water vapor in the atmosphere. Water vapor is the most powerful of all greenhouse gases according to the IPCC.
The counter argument to the positive feedback hypothesis is the negative feedback provided by increased cirrus cloud cover when temperatures rise. There is also the issue of the diminishing global temperature effect of CO2 as described by the five studies in the following image:

Although the numbers are different in each of the 5 studies, they all conclude the heat retention of CO2 decreases logarithmically as the concentration increases. Using the question's time period of 40 years, the CO2 will have increased by 80 PPM to approximately 490 PPM which falls within the first level of the above chart. Using the numbers from the last three columns, the increase in temperature from CO2 alone would range from  0.2 to 0.466 degrees centigrade.
One interesting conclusion from this chart is these 5 studies do not agree in the magnitude of the change which would indicate the science is not settled. Another point to be made is while CO2 concentrations increased constantly, temperatures fluctuated up and down over the same time period which indicates there are other factors in play besides CO2. These differences along with the lack of understanding of the effect the negative feedback of clouds are possible explanations of why the computer models fail to accurately mimic the actual temperature observations.
Since the computer models represent the gold standard upon which future temperature predictions are being made and coupled with the fact their predictions to date have been so wrong, it is reasonable to conclude the 133 mm rise is sea level is likely to be an accurate outcome over the next 40 years. If that is the case, then the action to be taken by various coastal cities would depend upon their specific circumstances. As for me, I do not intend to sell my coastal property based on the existing evidence.
Update:
The lowest parts of St. Petersburg, Russia are about 4 m above sea level. If my estimate of 133 mm sea level rise over the next 40 years is correct, then St. Petersburg will not be much worse off than they already are. I would assume the portions of the city that are that low are already having flooding issues during storms or even during high tides.