UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zTP00s2fxq5kpsAXhr0gLPT5ymtOJj5J8SPtKROhc6A='
WHERE
key_id = '316187eebb49e286a5ecc321b67bb9157e75fa58d9efb762d8813e1eac390968'
AND (
token = 'zTP00s2fxq5kpsAXhr0gLPT5ymtOJj5J8SPtKROhc6A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)