UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E3VKpN1adXAx+UyUKAx+SttRkUaREGxKOBcnWHUdADY='
WHERE
key_id = '8f2dc0bd9a2855be41356f577f62b7a1c902ec6ac36c6c9e81757ef062868f67'
AND (
token = 'E3VKpN1adXAx+UyUKAx+SttRkUaREGxKOBcnWHUdADY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)