UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cNln0qoqdTtDpgGsdWSeLGgNe9QNvPheEpi6VUK3J1s='
WHERE
key_id = 'af99299701bc0900bfe3a5289fdc04d3fded18937a66de3b3060d38bd30a4006'
AND (
token = 'cNln0qoqdTtDpgGsdWSeLGgNe9QNvPheEpi6VUK3J1s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)