UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JYF6aAB+Dm2y9jiqAO3soL7h4kOkx51MViDSZ8WpttY='
WHERE
key_id = '24671fd4cb68952fecc1ffb47833bba1162072c4656127ab77137952c173dd16'
AND (
token = 'JYF6aAB+Dm2y9jiqAO3soL7h4kOkx51MViDSZ8WpttY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)