UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TOszj1q0aOGcVk15kO/vNMLRzuI4vYfZky1+WGP5CBU='
WHERE
key_id = 'c99ef6c03a85351c2802f5bfe58546229bd12f7fdece4d17bd70f1be45237ecb'
AND (
token = 'TOszj1q0aOGcVk15kO/vNMLRzuI4vYfZky1+WGP5CBU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)