UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'niAbInXvhabzBfXE/eyfgks6wKVGdhTtidk9/MEA8KE='
WHERE
key_id = '8cf23d89aa8b69367f92889c3bd32daa021e61e16170302109e4ca1b0a1b3de5'
AND (
token = 'niAbInXvhabzBfXE/eyfgks6wKVGdhTtidk9/MEA8KE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)