The mechanical first law of black hole spacetimes with a cosmological constant and its application to the Schwarzschild–de Sitter spacetime