For $k=24,d=-17;m=8,n=3$, completing the square gives $(12+n)^2=m^2+161$ Where $161$ just happens to be the product of two primes $(q=7,p=23)$, so for large $k,m,n$ factoring may be very slow.
Alternatively, a sequence $17..29$ sums to $161$ and has $q=7$ terms, and the first is $2m+1$ and the last is $2q+2m-1$ (always(?)). Also $161 = q(q+2m)$. Obviously(?) $pq=161$ represents a hyperbola. I thought maybe there is a way to transform the equation to an ellipse or circle to make it more manageable, but it appears not so.
If factoring cannot be avoided, what method is most useful for $t>>161$, but $<=256=$digits.
I take it the problem is, given (sizable) $k$ and $d$, find $m$ and $n$ such that the equation in the title holds. As you have seen in your example, this will come down to expressing some number as a difference of two squares. But doing this is just as hard as factoring, so in general you will not find a solution unless you can factor the numbers that arise.