UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TfeQBWJ0DrXELS8wHWdSvoSNMfwsU6xiAflQUxMhGyk='
WHERE
key_id = '218afaa359855ea4ca74e394068b7896aa366e12eaaa16fb9b15f18a2572cd75'
AND (
token = 'TfeQBWJ0DrXELS8wHWdSvoSNMfwsU6xiAflQUxMhGyk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)