UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ESbZnZNw+vgVP/4WXtodWT3vkqeE9ylJKZxujs5zGGk='
WHERE
key_id = '16e1247284c2294e46d97757b383567a1ef16f94f734c0d013ce353eb9f1c3c0'
AND (
token = 'ESbZnZNw+vgVP/4WXtodWT3vkqeE9ylJKZxujs5zGGk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)