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