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