How long will this appliance run from a battery?
Short answer: 9 hours, 36 minutes

Long answer: 

Assuming the system is 100% efficient, (i.e. no resistive losses in cables, or internal resistance from battery)

Power (Watts) = I(Amps) * V(Voltage)

Therefore, 

Amps = Power/Voltage

50/12 = 4.16666A


Assuming that the battery is fully charged, then it will have the full 40AH capacity. 

This battery is not linked to a boost converter or anything like that, so it would be 4.16 amps at 12 volts, so we don't need to do any more calculating here. If the power output was not at 12v, then we would reverse the power equation to do 12*40 = 480WH. This means the battery can provide 480 Watts for 1 hour.

40AH (Amp Hours)/4.16Amps = 9.6 hours, or 9 hours and 36 minutes.
or
480WH (Watt Hours)/50 (Watts) = 9.6 hours, or 9 hours and 36 minutes.


Longer answer:

Sadly, in the real world, nothing is as easy as this. Batteries are not perfect. They have some internal resistance, which we have to factor in.

We can also calculate the resistive losses from the internal resistance of the battery from the 400A rating

R = V/I
R = 12/400
R = 0.03 ohms


P = I^2 * R
P = 4.16^2 * 0.03 = 0.52083W lost 


In 1 hour = 0.52083Wh lost, as you multiply by one.
Therefore, in 9.6 hours, it means 5 watts is lost.

480Wh - 0.52083Wh = 479.49716 Wh

479.49716/50 = 9.589583 hours.

This is 9 hours, 35 minutes and 22.5 seconds