Since nothing but the sacrifice tries to move the Martyr, the Martyr would still be on the battlefield if it wasn't sacrificed. The Martyr was sacrificed, so the cost was payed, so your opponent gains the life[1]. Athreos caused a triggered ability to happen to Martyr after Martyr's ability was put on the stack, but that doesn't matter.
The steps taken in order are:
- The costs are paid for Martyr of Sands's ability: One mana is paid, you reveal some number of white cards from your hand, and Martyr of Sands is placed in the graveyard.
- Martyr of Sands's ability is placed on the stack, but doesn't resolve yet.
- Athreos's triggered ability is triggered and then placed on the stack.
- Athreos's ability resolves. In this case, you decide not to pay three life, and Martyr of Sands is returned to your opponent's hand.
- Martyr of Sands's ability resolves, causing your opponent to gain three times X life.
Additionally, your opponent would still gain the life even if the sacrifice itself was replaced with another action[CR 117.11][2]: the cost to activate the ability would have changed, but the ability would still have the same effect when resolving.
117.11. The actions performed when paying a cost may be modified by effects. Even if they are, meaning the actions that are performed don’t match the actions that are called for, the cost has still been paid.
- The sacrifice happened (even if the creature didn't end up in the graveyard), so abilities that trigger when you sacrifice a creature (such as Dragon Appeasement's second ability) will trigger.
- The sacrifice itself was replaced, so abilities that trigger when you sacrifice a creature (such as Dragon Appeasement's second ability) won't trigger[CR 614.6].