UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XwYpC4r5m8UCr4xTIvgsMNzlTBVNBjGgwGBAPgGjbXs='
WHERE
key_id = '3745a2e14f7e6f879a563c17d2d50c224e650c818c5abde3a15aff24fa61c0d6'
AND (
token = 'XwYpC4r5m8UCr4xTIvgsMNzlTBVNBjGgwGBAPgGjbXs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)