UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4uXEGnlOKh80JLdZSiQdN9xkdE2hrrrFRGjpC3lqqt0='
WHERE
key_id = '812873e7bc70a136df4a62b728ac88640ebf73c88c43d5cbee602e22be633344'
AND (
token = '4uXEGnlOKh80JLdZSiQdN9xkdE2hrrrFRGjpC3lqqt0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)