UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YVkEtBTL9TsSYh3vkqa6RRgdINmr/pYKDybuWtOYMmM='
WHERE
key_id = 'a59f5a3e96c65467fb6026a250ef36708d8d79b34d19e0ea0178d4c7570e2661'
AND (
token = 'YVkEtBTL9TsSYh3vkqa6RRgdINmr/pYKDybuWtOYMmM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)