UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RaVDQltW0L9GPefLHUtRlVFGNGVTNMJ+7P6tKaZWgzA='
WHERE
key_id = 'b141b1f971acf9bb1a72ba903e1608eb97f40248d5b16452ead0176fde750eef'
AND (
token = 'RaVDQltW0L9GPefLHUtRlVFGNGVTNMJ+7P6tKaZWgzA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)