SUMMARY: with
$$ \color{blue}{b^2 - 4ac = \delta^2,} $$
take
$$ \color{blue}{ a_1 = \gcd \left( a,
\frac{(b + \delta)}{2} \right) ; \; \; \; \; \; a_2 = \frac{a}{a_1},} $$
then
$$ \color{blue}{ a x^2 + b x y + c y^2 = \; \left(a_2x+ \left( \frac{b + \delta}{2a_1} \right) y \right) \; \; \left(a_1x+ \left( \frac{b - \delta}{2a_2} \right) y \right) \; } $$ in integers. If you do not want the variable $y,$ set
$$ y=1. $$
EXAMPLE: $30 x^2 + 97 xy + 55 y^2.$ $a = 30, b = 97, c = 55.$ $b^2 - 4ac = 2809,$ $\delta = \sqrt {b^2 - 4ac} = 53.$ $(b+\delta)/ 2 = 75.$ $a_1 = \gcd(30,75) = \gcd(30, 15) = 15.$ $(b+\delta)/ (2 a1) = 75/15 = 5.$ $a_2 = 30/15 = 2.$ $(b-\delta)/ 2 = 22.$ $(b-\delta)/ (2 a_2) = 22/2 =11.$
$$ 30 x^2 + 97 xy + 55 y^2 = (2x+5y)(15x+11y) $$
EXAMPLE: $4 x^2 + 5 xy + y^2.$ $a = 4, b = 5, c = 1.$ $b^2 - 4ac = 9,$ $\delta = \sqrt {b^2 - 4ac} = 3.$ $(b+\delta)/ 2 = 4.$ $a_1 = \gcd(4,4) = 4.$ $(b+\delta)/ (2 a1) = 4/4 = 1.$ $a_2 = 4/4 = 1.$ $(b-\delta)/ 2 = 1.$ $(b-\delta)/ (2 a_2) = 1/1 =1.$
$$ 4 x^2 + 5 xy + y^2 = (x+y)(4x+y) $$
ORIGINAL: Either the one-variable function $$ a x^2 + b x + c $$ or the quadratic form
$$ a x^2 + b x y + c y^2, $$ with integers $a,b,c,$ factor over the rational numbers if and only if the discriminant
$$ \Delta = b^2 - 4 a c $$ is a square.
You are familiar with this because of the quadratic formula
$$ \frac{-b \pm \sqrt \Delta}{2a} $$
which gives the roots $x$ for $ a x^2 + b x + c =0. $
Only a little changes when inserting the letter $y,$ giving $ a x^2 + b x y + c y^2. $ First, if both $a,c$ are $0,$ then we have $bxy$ which is already factored. So, let me show the traditional case, when $a \neq 0.$ Also let
$$ \Delta = \delta^2, $$ say with integer $\delta \geq 0.$
$$ a x^2 + b x y + c y^2 = \frac{1}{4a} \left( 4 a^2 x^2 + 4 a b x y + 4 a c y^2 \right) $$
$$ = \frac{1}{4a} \left( 4 a^2 x^2 + 4 a b x y + b^2 y^2 - b^2 y^2 + 4 a c y^2 \right) $$
$$ = \frac{1}{4a} \left( 4 a^2 x^2 + 4 a b x y + b^2 y^2 - (b^2 y^2 - 4 a c y^2) \right) $$
$$ = \frac{1}{4a} \left( 4 a^2 x^2 + 4 a b x y + b^2 y^2 - (b^2 - 4 a c ) y^2 \right) $$
$$ = \frac{1}{4a} \left( 4 a^2 x^2 + 4 a b x y + b^2 y^2 - \Delta y^2 \right) $$
$$ = \frac{1}{4a} \left( (2ax+by)^2 - \Delta y^2 \right) $$
$$ = \frac{1}{4a} \left( (2ax+by)^2 - \delta^2 y^2 \right) $$
$$ = \frac{1}{4a} \left( \; (2ax+by + \delta y) \; (2ax+by - \delta y) \; \right) $$
$$ = \frac{1}{4a} \left( \; (2ax+ (b + \delta) y) \; (2ax+ (b - \delta) y) \; \right) $$
Now, either $b,\delta$ are both even or both odd. Either way, we may absorb a factor of $4$ into
$$ = \frac{1}{a} \left( \; (ax+ \frac{(b + \delta)}{2} y) \; (ax+ \frac{(b - \delta)}{2} y) \; \right) $$
Finally, since
$$ \frac{(b + \delta)}{2} \frac{(b - \delta)}{2} = \frac{b^2 - \Delta}{4} = ac $$
is divisible by $a,$ by unique factorization we may write
$$a = a_1 a_2$$ with $a_1$ dividing the first fraction and $a_2$ the second: in fact, we may simply take $$ a_1 = \gcd \left( a,
\frac{(b + \delta)}{2} \right) ; \; \; \; \; \; a_2 = \frac{a}{a_1} $$ without paying attention to any prime factorizations of $a.$
We finally get
$$ a x^2 + b x y + c y^2 = \; \left(a_2x+ \left( \frac{b + \delta}{2a_1} \right) y \right) \; \; \left(a_1x+ \left( \frac{b - \delta}{2a_2} \right) y \right) \; $$ in integers.