In the UK, only the first is correct.
You may hear the second in informal speech in some parts of the USA however, I have been told by an American teacher on Italki, that she would teach only the first option as correct.
Look up grammar on the second conditional.