UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wtkZHlWGTJe6ViZnNSk0aPNdWciwEM+LiTT05vVtjbk='
WHERE
key_id = '1d08bb9850708d915f15bc37e7c637527cad29acfaa49f7ece9a7e8109d50457'
AND (
token = 'wtkZHlWGTJe6ViZnNSk0aPNdWciwEM+LiTT05vVtjbk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)