UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sWVyW6ae8IUjK3L/zQihbNlxhL5sC0TNuWN0fJwm8sQ='
WHERE
key_id = 'f0b4b5f27cc8db6beca1271381432b371e761877415dc0340a3c845a326d3ee3'
AND (
token = 'sWVyW6ae8IUjK3L/zQihbNlxhL5sC0TNuWN0fJwm8sQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)