An M label or a 54 cm measurement is a starting point, not a universal answer. Sloping top tubes and different frame geometries mean similar labels can hide different dimensions. Look for the sizing chart for that particular model.
In person, check both clearance above the frame with your feet on the ground and the distance to the handlebar. Being able to stand over a bike does not establish a good fit on its own. You should reach the brake levers comfortably without overstretching.
Your intended riding matters too. A relaxed city position and a sporting road position are different requirements. Saddle and handlebar adjustments can refine the fit, but they cannot always compensate for a frame whose geometry fundamentally disagrees with the position you want.
Before arranging a viewing, confirm the exact model and frame size. Allow time for a short ride and compare how the bicycle feels, not just its equipment list. A good purchase starts with a bicycle you actually want to ride.