UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X9kgV8py95YpKJBO9rHq98SxfdLkn8Phz0rMmhPmXJo='
WHERE
key_id = '20238f4e070830c32cfb3e99c97f3269e49f4691bf593a936000f40b208d4edf'
AND (
token = 'X9kgV8py95YpKJBO9rHq98SxfdLkn8Phz0rMmhPmXJo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)