Sorry, this will be difficult if not impossible based on the info you supplied.
From 1735-65 there were at least 16 births of a John Hamilton in Lesmahagow alone. And dozens more in surrounding Parishes. You could try to match John/Mary's children's given names against these 16 using the infamous Scottish Naming Pattern, but there are variations to consider and no guarantees these are his parents. Does the Marriage Bann from Scot's People state whether he was from this parish or does it state another parish?
Don