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