The electronic structure and sodium diffusion in Na4-xKxMg(MoO4)3 with an alluadite structure have been investigated by ab initio methods. It was found that this molybdate is an insulator with a band gap of 3.5 eV for x = 0.25. The most probable positions of potassium in the sodium sublattice have been determined, and the preferred pathways for sodium migration have been established. It has been shown that the barriers to sodium diffusion in Na4-xKxMg(MoO4)3 significantly depend on the composition, position of potassium, and migration path. The introduction of potassium leads to a significant decrease in the barriers to both one-dimensional (1D) and two-dimensional (2D) sodium diffusion. However, the presence of potassium in 1D channels can hinder the rapid migration of sodium, and a sharp increase in conductivity occurs only at high temperatures due to the order-disorder transition.