UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0NNQ4fp+5xw043BEtvnIYn146rcp9p+tqqsAFpzoXwU='
WHERE
key_id = '8a8a796e20e22dd2218955f4212668bd33cb693a4c066f4f081547b12b7d10a8'
AND (
token = '0NNQ4fp+5xw043BEtvnIYn146rcp9p+tqqsAFpzoXwU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)