If the condition
$$
a x^2 + 2 h x y + b y^2 + 2 g x + 2 f y + c = 0
$$
represents the product of two lines then the set of solutions for this conditions should be one solution point, void or infinite solution points associated to the cases in which we have the two lines intersection, two lines parallel and two lines coincident. With this idea we follow obtaining
$$
x = \frac{gh-af\pm2\sqrt{(g+hy)^2-a(b y^2+2fy+c)}}{2a}
$$
If the intersection point is unique then the condition is
$$
(g + h y)^2 - a (c + 2 f y + b y^2) = 0
$$
which gives
$$
y = \frac{gh-af\pm\sqrt{a^2 f^2 + a b g^2 - 2 a f g h + a c h^2-a^2 b c}}{ab-h^2}
$$
but again if the intersection point is unique we should have
$$
a^2 f^2 + a b g^2 - 2 a f g h + a c h^2-a^2 b c = 0
$$
or
$$
c = \frac{a f^2+b g^2-2 f g h}{a b-h^2}
$$
The condition for distinct parallel lines follow as
$$
a b -h^2 = 0
$$
Another approach:
Assuming $a \ne 0$ and dividing $ax^2+2hxy+by^2+2gx+2fy+c=0$ by $a$ we have
$$
x^2+b' y^2 + c' + 2 f' y + 2 g'x +2 h' xy = (x+c_1 y + c_2)(x+d_1 y + d_2)
$$
after equating coefficients and solving for $c_1,c_2,d_1,d_2$ we have the conditions
$$
\cases{h'^2-b' > 0\\
c' = -\frac{f'^2-b' g'^2-2f' g' h'}{h'^2-b'}}
$$
such that the two lines equivalence is feasible.
or equivalently
$$
\cases{
h^2-a b > 0\\
c = \frac{a f^2+b g^2-2f g h}{a b -h^2}
}
$$