How to calculate least common multiple (LCM) for two numbers with constants (shifts)?
Given integers $a,b \geq 1$ and $c,d \geq 0$, you are looking for the set of solutions of $ax + c = by + d$ over integers $x,y \geq 0$. We can assume without loss of generality that $d = 0$ (replace $c,d$ with $c-d,0$ or $0,d-c$) and that $(a,b,c) = 1$ (otherwise, divide everything by the GCD).

I claim that if there is any solution then necessarily $(a,b) = 1$. Indeed, suppose that $(a,b) = g &gt; 1$. If $ax + c = by$ then $g \mid ax,by$ implies $g \mid c$, and so $(a,b,c) = g &gt; 1$, contrary to assumption. Therefore $(a,b) = 1$.

If $ax + c = by$ then $ax + c \equiv 0 \pmod{b}$ and so $x \equiv -c/a \pmod{b}$ (note that we can divide by $a$ since $(a,b)=1$). Similarly, $y \equiv c/b \pmod{a}$. These equations essentially give us both the minimal solution and all solutions.

As a demonstration, consider your example: $30x+10 = 25y+5$. This is equivalent to $6x+1 = 5y$, so $(a,b,c) = (6,5,1)$. Any solution must satisfy $x \equiv -1/6 \equiv 4 \pmod{5}$ and $y \equiv 1/5 \equiv 5 \pmod{6}$. Indeed, $6 \cdot 4 + 1 = 5 \cdot 5$. The general solution is $(x,y) = (4+5N,5+6N)$.