I think while doing the calculations, I have found the answer. @GK gave an answer but I think there is a subtle mistake in that approach because both q and $\tau$ are coupled transformations of x and t. Thus the total derivative is not equal to the partial one. So this is my solution.
$q$ and $\tau$ both can be expressed a function of $(x,t)$. From the definition of a total derivative
$$\frac{dq}{dt} = \Big(\frac{\partial q}{\partial x}\Big)\frac{dx}{dt} + \frac{\partial q}{\partial t}$$
\begin{equation}
\Rightarrow \frac{dq}{dt} = \cosh(\psi) \frac{dx}{dt} + \sinh(\psi)
\end{equation}
Similarly we have
$$\frac{d\tau}{dt} = \Big(\frac{\partial \tau}{\partial x}\Big)\frac{dx}{dt} + \frac{\partial \tau}{\partial t}$$
\begin{equation}
\Rightarrow \frac{d\tau}{dt} = \sinh(\psi) \frac{dx}{dt} + \cosh(\psi)
\end{equation}
From (1) and (2) we have
$$ \frac{dq}{d\tau} = \dfrac{\cosh(\psi) \frac{dx}{dt} + \sinh(\psi)}{\sinh(\psi) \frac{dx}{dt} + \cosh(\psi)}$$
$$\Rightarrow 1- \Big(\frac{dq}{d\tau}\Big)^{2}= 1- \Bigg(\dfrac{\cosh(\psi) \frac{dx}{dt} + \sinh(\psi)}{\sinh(\psi) \frac{dx}{dt} + \cosh(\psi)}\Bigg)^{2}$$
Going through the algebra and simplifying using (2) we get
$$\Rightarrow 1- \Big(\frac{dq}{d\tau}\Big)^{2}= \dfrac{(\sinh^{2}(\psi) - \cosh^{2}(\psi))(\frac{dx}{dt})^{2}+(\cosh^{2}(\psi) - \sinh^{2}(\psi))}{(\frac{d\tau}{dt})^{2}} $$
Using the well know trig identity $\cosh^{2}(\psi) - \sinh^{2}(\psi) = 1$ we have,
$$\Rightarrow 1- \Big(\frac{dq}{d\tau}\Big)^{2}= \dfrac{1-(\frac{dx}{dt})^{2}}{(\frac{d\tau}{dt})^{2}} $$
We know the Lagrangian $L^{\prime} = - \sqrt{1- \Big(\frac{dq}{d\tau}\Big)^{2}} $
Thus $$L^{\prime} = (\frac{dt}{d\tau})L $$
$$ \Rightarrow L^{\prime}(\dot{q}) d\tau = L(\dot{x}) dt $$
$$ \Rightarrow S^{\prime} [L^{\prime}] = S[L]$$
Even though the Lagrangian doesn't stay the same, the action does !