UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Gm5YRk4yIWY4e9g+UKYajH/57Yq1B5bccoD2Wi3ptp0='
WHERE
key_id = 'a9fb51e8e647f817e4feb3745d2891fa78dcdbdeb51666e512cedf7f64decd09'
AND (
token = 'Gm5YRk4yIWY4e9g+UKYajH/57Yq1B5bccoD2Wi3ptp0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)