UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CL5Q21Ch991vkyi+XJmegRB9GtGGDYGT+wBgP7/01d8='
WHERE
key_id = '859c66edb70be6ac22be7326a61e915d8577df29c5803e47369012b6e46927f9'
AND (
token = 'CL5Q21Ch991vkyi+XJmegRB9GtGGDYGT+wBgP7/01d8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)