Denote by $p_X$ the natural projection $X\times Y\to X$ and define $p_Y$ similarly.  Kunneth formula shows that any $\newcommand{\bZ}{\mathbb{Z}}$  $w\in H^1(X\times Y,\bZ/2)$ has the form

$$ w= p_X^* u+p_Y^* v,\;\;u\in H^1(X,\bZ/2),\;\;v\in H^1(Y.\bZ/2). $$

Tjis proves that any  real line bundle  $L\to X\times Y$    has the form


$$ L= p_X^*L_X\otimes p_Y^*L_Y, $$

with

$$w_1(L)=p_X^*w_1(L_X)+p^*_Y w_1(L_Y). $$


Moreover

$$ L|_{X\times y}= L_X. $$

The line bundles with the properties you want are all pullbacks of nontrivial line bundles on $Y$.