UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1HAiB4znzHHNgpUuqzvKX4SHlcB8QeghLDWknnRWuQQ='
WHERE
key_id = 'f4ace16907df3cef76636e39dc7c12b315567b16d32b3ff032a7e0a230c430ec'
AND (
token = '1HAiB4znzHHNgpUuqzvKX4SHlcB8QeghLDWknnRWuQQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)