This isn't necessarily good news. Sun burn is your body's way of reducing skin cancer. When your body detects too much exposure to sun, it kills the cells that are most likely to have suffered DNA damage. The soreness and inflammation are a result of that mechanism. Disabling that mechanism would cause skin cancer.
But maybe melatonin promotes DNA repair and thus the cells don't need to be killed. More research needed :-)