UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NKhDQBwOqpoCVfuG0Aiv6hJdQ54EpxOtAhAd6zwzcWw='
WHERE
key_id = '4be99470ceedf1cddfabbf7911e88f914f932eda9ee08cf23d5cbdf08e339fe5'
AND (
token = 'NKhDQBwOqpoCVfuG0Aiv6hJdQ54EpxOtAhAd6zwzcWw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)