How to re lock bootloader on samsung galaxy s5?
First off, you don't get your warranty back, you hide that you unlocked and rooted in the first place (so you never "actually" lost warranty) . I don't know Samsung devices all that well, have you tried booting into fastboot and doing "fastboot oem lock"? If your device doesn't have fastboot obviously this won't work. Usually carriers and the phone companies can find out bootloader status by booting into bootloader with" adb reboot bootloader" or some key combination. 

Tip: if you are using SuperSU as your superuser app, there will be an unroot option in it. Good luck!