UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NN0EaunsOi+jPYhKl9SdVUubh8T50H8vyCEk0BDuBYs='
WHERE
key_id = '49c7a94e833e9a6eb7169b75964d15cccbea49c903e40941708a456b3e13d08c'
AND (
token = 'NN0EaunsOi+jPYhKl9SdVUubh8T50H8vyCEk0BDuBYs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)