UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XwoD+m9zyP4TpkXzfX4Pa0SHWxP8SIY0df18XeT/ohs='
WHERE
key_id = '40d6161285d216e1f45101b1bc283f692a98ca6503933b58d046fce741305d24'
AND (
token = 'XwoD+m9zyP4TpkXzfX4Pa0SHWxP8SIY0df18XeT/ohs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)