UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BmkJISPZifwBKwBEHRRQI1f7d2W3/QtTww98K6nihec='
WHERE
key_id = 'f88b20d84d64fd9bf9817f070b32f04eb69a9e5561a8268d05fc4fa81be392f7'
AND (
token = 'BmkJISPZifwBKwBEHRRQI1f7d2W3/QtTww98K6nihec='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)