UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ncx7EQet6tzZoPAFc/8e8k4IuxS5sBtmqnjEaOZQwFE='
WHERE
key_id = '97c791bb07230c389ca12a806d555c8fc96971f8d522ede6b2fe94b608980e08'
AND (
token = 'ncx7EQet6tzZoPAFc/8e8k4IuxS5sBtmqnjEaOZQwFE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)