UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XWtXAe59THyJh5vkHeIL43a231zXrfXw82DybI2RxDs='
WHERE
key_id = '5c2550bfcfc824b61286223161f5661687c391ea270d8ae579a6da17d9096acb'
AND (
token = 'XWtXAe59THyJh5vkHeIL43a231zXrfXw82DybI2RxDs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)