A man who had sex with a vulnerable teenage child in a McDonald’s restaurant toilet has been jailed and placed on the sex offenders' register.