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